package ar.uba.fi.tp2Unit;

import ar.uba.fi.tp2Unit.displayers.ConsoleTestResultDisplayer;
import ar.uba.fi.tp2Unit.displayers.GUITestResultDisplayer;
import ar.uba.fi.tp2Unit.displayers.XMLFileTestResultDisplayer;
import ar.uba.fi.tp2Unit.framework.TestNameAlreadyExistsException;
import ar.uba.fi.tp2Unit.framework.TestRunner;
import ar.uba.fi.tp2Unit.framework.TestSuite;

public class MyTestApp {

	public static void main(String[] args){

		//Example 1: Results in console by default
//		try {
//			TestRunner.run(new MyFirstTestSuite("MyFirstTestSuite"));
//		} catch (TestNameAlreadyExistsException e) {
//			System.out.println("It should't get here!");
//		}

		//Example 2: Results in console explicitly
//		try {
//			TestRunner.run(new MyFirstTestSuite("MyFirstTestSuite"), new ConsoleTestResultDisplayer());
//		} catch (TestNameAlreadyExistsException e) {
//			System.out.println("It should't get here!");
//		}

		//Example 3: Results in GUI
//		try {
//			TestRunner.run(new MyFirstTestSuite("MyFirstTestSuite"), new GUITestResultDisplayer());
//		} catch (TestNameAlreadyExistsException e) {
//			System.out.println("It should't get here!");
//		}

		//Example 4: Results in file
//		try {
//			TestRunner.run(new MyFirstTestSuite("MyFirstTestSuite"), new FileTestResultDisplayer("/tmp/results.txt"));
//		} catch (TestNameAlreadyExistsException e) {
//			System.out.println("It should't get here!");
//		}
		
		//Example 5: TestSuite with setUp
//		try {
//			TestRunner.run(new MyFirstTestSuiteWithSetUp("MyFirstTestSuiteWithSetUp"), new GUITestResultDisplayer());
//		} catch (TestNameAlreadyExistsException e) {
//			System.out.println("It should't get here!");
//		}
		
		//Example 6:
		TestSuite suite = new TestSuite("MySuite");
		try {
			suite.addTest(new MyFirstTestSuite("MyFirstTestSuite"));
			suite.addTest(new MyFirstTestSuiteWithSetUp("MyFirstTestSuiteWithSetUp"));
			suite.addTest(new MyTestWithFailAndError("MyTestWithFailAndError"));
		} catch (TestNameAlreadyExistsException e) {
			System.out.println("It should't get here!");
		}
		TestRunner.run(suite, new ConsoleTestResultDisplayer());
		//TestRunner.run(suite, new XMLFileTestResultDisplayer("/home/marcelo/Descargas/tp2UnitTests.xml"));
		
	}

}
